<?php include template("manage_header");?>

<div id="bdw" class="bdw">
<div id="bd" class="cf">
<div id="leader">
	<div class="dashboard" id="dashboard">
		<ul><?php echo mcurrent_team('team'); ?></ul>
	</div>
	<div id="content" class="clear mainwide">
        <div class="clear box">
            <div class="box-top"></div>
            <div class="box-content">
                <div class="head">
				<?php if($team['id']){?>
					<h2>Editar</h2>
					<ul class="filter"><?php echo current_manageteam('edit', $team['id']); ?></ul>
				<?php } else { ?>
					<h2>Criar Oferta</h2>
				<?php }?>
				</div>
                <div class="sect">
				<form id="-user-form" method="post" action="/manage/team/edit.php?id=<?php echo $team['id']; ?>" enctype="multipart/form-data" class="validator">
					<input type="hidden" name="id" value="<?php echo $team['id']; ?>" />
					<div class="wholetip clear"><h3>1,Informações Basicas</h3></div>
					<div class="field">
						<label>Tipo de Oferta</label>
						<select name="team_type" class="f-input" style="width:160px;" onchange="X.team.changetype(this.options[this.options.selectedIndex].value);"><?php echo Utility::Option($option_teamtype, $team['team_type']); ?></select><select name="city_id" class="f-input" style="width:160px;"><?php echo Utility::Option(Utility::OptionArray($allcities, 'id','name'), $team['city_id'], 'todas as cidades'); ?></select>
						<select name="group_id" class="f-input" style="width:160px;"><?php echo Utility::Option($groups, $team['group_id']); ?></select>
					</div>
					<div class="field" id="field_limit">
						<label>Condições</label>
						<select name="conduser" class="f-input" style="width:400px;"><?php echo Utility::Option($option_cond, $team['conduser']); ?></select>
					</div>
                    <div class="field" id="field_limit">
                        <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
                        <select name="buyonce" class="f-input" style="width:400px;"><?php echo Utility::Option($option_buyonce, $team['buyonce']); ?></select>
				  </div>
					<div class="field">
		          <label>Oferta</label>
						<input type="text" size="30" name="title" id="team-create-title" class="f-input" value="<?php echo htmlspecialchars($team['title']); ?>" datatype="require" require="true" />
					</div>
					<div class="field">
						<label>Valor R$</label>
						<input type="text" size="10" name="market_price" id="team-create-market-price" class="number" value="<?php echo moneyit($team['market_price']); ?>" datatype="money" require="true" />
						<label>Oferta R$</label>
						<input type="text" size="10" name="team_price" id="team-create-team-price" class="number" value="<?php echo moneyit($team['team_price']); ?>" datatype="double" require="true" />
						<label>Quant. virtual</label>
						<input type="text" size="10" name="pre_number" id="team-create-pre_number" class="number" value="<?php echo intval($team['pre_number']); ?>" datatype="number" require="true" /> Quant. de compradores virtuais
					</div>
					<div class="field">
				      <label>Cota Min.</label>
						<input type="text" size="10" name="min_number" id="team-create-min-number" class="number" value="<?php echo intval($team['min_number']); ?>" maxLength="6" datatype="number" require="true" />
					  <label>Cota Max.</label>
						<input type="text" size="10" name="max_number" id="team-create-max-number" class="number" value="<?php echo intval($team['max_number']); ?>" maxLength="6" datatype="number" require="true" />
					<label>Max/ pessoa</label>
					  <input type="text" size="10" name="per_number" id="team-create-per-number" class="number" value="<?php echo intval($team['per_number']); ?>" maxLength="6" datatype="number" require="true" />
						<span class="hint"><strong>Cota Min.</strong> deve ser maior que 0 /
						<strong>Cota Max.</strong> Coloque 0 para setar sem limites </p>
                        <strong>Max/ pessoa.</strong> Quant. máxima que o cliente pode comprar</span>
					</div>
					<div class="field">
						<label>Começar em</label>
						<input type="text" size="30" name="begin_time" id="" class="numberd" xd="<?php echo date('d-m-Y', $team['begin_time']); ?>" xt="<?php echo date('H:i:s', $team['begin_time']); ?>" value="<?php echo date('d-m-Y H:i:s', $team['begin_time']); ?>" maxlength="30" /></div>
<div class="field">
						<label>Terminar em</label>
						<input type="text" size="30" name="end_time" id="" class="numberd" xd="<?php echo date('d-m-Y', $team['end_time']); ?>" xt="<?php echo date('H:i:s', $team['end_time']); ?>" value="<?php echo date('d-m-Y H:i:s', $team['end_time']); ?>" maxlength="30" /></div>
<div class="field">
						<label><?php echo $INI['system']['couponname']; ?> até</label>
						<input type="text" size="30" name="expire_time" id="" class="numberd" value="<?php echo date('d-m-Y', $team['expire_time']); ?>" maxLength="30" />
						<span class="hint">formato da Data/hora: DD-MM-YYYY HH:MM:SS. exemplo: 05-12-2010 23:12:09.</span>
					</div>
					<div class="field">
						<label>Descrição</label>
						<div style="float:left;"><textarea cols="45" rows="5" name="summary" id="team-create-summary" class="f-textarea editor2" datatype="require" require="true"><?php echo htmlspecialchars($team['summary']); ?></textarea></div>
					</div>
					<div class="field">
						<label>Regulamento</label>
						<div style="float:left;"><textarea cols="45" rows="5" name="notice" id="team-create-notice" class="f-textarea editor1" style="width:710px;height:150px;"><?php echo $team['notice']; ?></textarea></div>
						<span id="result_box" lang="pt" xml:lang="pt"><span class="hint">descrever o regulamento e a validade da oferta</span></span></div>
					<!--kxx -->
					<div class="field">
						<label>Ordem</label>
						<input type="text" size="10" name="sort_order" id="team-create-sort_order" class="number" value="<?php echo $team['sort_order'] ? $team['sort_order'] : 0; ?>" datatype="number"/><span class="inputtip">Definir um numero maior para a oferta principal</span>
					</div>
					<!--xxk-->
					<input type="hidden" name="guarantee" value="Y" />
					<input type="hidden" name="system" value="Y" />
					<div class="wholetip clear"><h3>2. Informações desta Oferta</h3></div>
					<div class="field">
						<label>Parceiro</label>
						<select name="partner_id" datatype="require" require="require" class="f-input" style="width:200px;"><?php echo Utility::Option($partners, $team['partner_id'], '--- Escolha o parceiro ---'); ?></select><span class="inputtip">Parceiro é opcional</span>
					</div>
					<div class="field" id="field_card">
						<label>Cartão desconto</label>
						<input type="text" size="10" name="card" id="team-create-card" class="number" value="<?php echo moneyit($team['card']); ?>" require="true" datatype="money" />
						<span class="inputtip">O maior valor do cartão pode ser usado</span>
					</div>
					<div class="field" id="field_card">
						<label>Desconto de convite</label>
						<input type="text" size="10" name="bonus" id="team-create-bonus" class="number" value="<?php echo moneyit($team['bonus']); ?>" require="true" datatype="money" />
						<span class="inputtip">a quantidade de desconto que você recebe de convites de indicação</span>
					</div>
					<div class="field">
						<label>Nome no cupom</label>
						<input type="text" size="30" name="product" id="team-create-product" class="f-input" value="<?php echo $team['product']; ?>" datatype="require" require="true" />
					</div>
					<div class="field">
						<label>Titulo opções</label>
						<input type="text" size="30" name="condbuy_titulo" id="team-create-condbuy_titulo" class="f-input" value="<?php echo $team['condbuy_titulo']; ?>" />
						<span class="hint">ex. escolha a cor preferida</span>
					</div>
					<div class="field">
						<label>Opções</label>
						<input type="text" size="30" name="condbuy" id="team-create-condbuy" class="f-input" value="<?php echo $team['condbuy']; ?>" />
						<span class="hint">ex. de formato {amarelo}{azul}{vermelho} usuário irá escolher entre uma desas três opções</span>
					</div>
					<div class="field">
						<label>Foto 1</label>
						<input type="file" size="30" name="upload_image" id="team-create-image" class="f-input" />
						<?php if($team['image']){?><span class="hint"><?php echo team_image($team['image']); ?></span><?php }?>
					</div>
					<div class="field">
						<label>Foto 2</label>
						<input type="file" size="30" name="upload_image1" id="team-create-image1" class="f-input" />
						<?php if($team['image1']){?><span class="hint" id="team_image_1"><?php echo team_image($team['image1']); ?>&nbsp;&nbsp;<a href="javascript:;" onclick="X.team.imageremove(<?php echo $team['id']; ?>, 1);">delete</a></span><?php }?>
					</div>
					<div class="field">
						<label>Foto 3</label>
						<input type="file" size="30" name="upload_image2" id="team-create-image2" class="f-input" />
						<?php if($team['image2']){?><span class="hint" id="team_image_2"><?php echo team_image($team['image2']); ?>&nbsp;&nbsp;<a href="javascript:;" onclick="X.team.imageremove(<?php echo $team['id']; ?>, 2);">delete</a></span><?php }?>
					</div>
					<div class="field">
						<label>FLV Video</label>
						<input type="text" size="30" name="flv" id="team-create-flv" class="f-input" value="<?php echo $team['flv']; ?>" />
						<span class="hint">formato deve ser: http://.../video.flv</span>
					</div>
					<div class="field">
						<label>Detalhes da Oferta / Produto</label>
						<div style="float:left;"><textarea cols="45" rows="5" name="detail" id="team-create-detail" class="f-textarea editor1"><?php echo htmlspecialchars($team['detail']); ?></textarea></div>
					</div>
					<div class="field" id="field_userreview">
						<label>Qualidade do Produto</label>
						<div style="float:left;"><textarea cols="45" rows="5" name="userreview" id="team-create-userreview" class="f-textarea editor1"><?php echo htmlspecialchars($team['userreview']); ?></textarea></div>
						<span class="hint"></span>
					</div>
					<div class="field">
						<label> Comentário da <?php echo $INI['system']['abbreviation']; ?></label>
						<div style="float:left;"><textarea cols="45" rows="5" name="systemreview" id="team-create-systemreview" class="f-textarea editor1" style="width:710px;height:150px;"><?php echo htmlspecialchars($team['systemreview']); ?></textarea></div>
					</div>
					<div class="wholetip clear"><h3>3, Informações de envio</h3></div>
					<div class="field">
						<label>Modo de entrega</label>
						<div style="margin-top:5px;" id="express-zone-div"><input type="radio" name="delivery" value="coupon" <?php echo $team['delivery']=='coupon'?'checked':''; ?> />&nbsp;<?php echo $INI['system']['couponname']; ?>&nbsp;<input type="radio" name="delivery" value='express' <?php echo $team['delivery']=='express'?'checked':''; ?> />&nbsp;Entrega Rápida</div>
					</div>
					<div id="express-zone-coupon" style="display:<?php echo $team['delivery']=='coupon'?'block':'none'; ?>;">
						<div class="field">
							<label>até</label>
							<input type="text" size="10" name="credit" id="team-create-credit" class="number" value="<?php echo moneyit($team['credit']); ?>" datatype="money" require="true" />
							<span class="inputtip">Consumer<?php echo $INI['system']['couponname']; ?>Obtained when the account balance rebate,</span>
						</div>
					</div>
					<div id="express-zone-pickup" style="display:<?php echo $team['delivery']=='pickup'?'block':'none'; ?>;">
						<div class="field">
							<label>Tel</label>
							<input type="text" size="10" name="mobile" id="team-create-mobile" class="f-input" value="<?php echo $team['mobile']; ?>" />
						</div>
						<div class="field">
							<label>Local</label>
							<input type="text" size="10" name="address" id="team-create-address" class="f-input" value="<?php echo $team['address']; ?>" />
						</div>
					</div>
					<div id="express-zone-express" style="display:<?php echo $team['delivery']=='express'?'block':'none'; ?>;">
						<div class="field">
							<label>Taxa de entrega</label>
							<input type="text" size="10" name="fare" id="team-create-fare" class="number" value="<?php echo intval($team['fare']); ?>" maxLength="6" datatype="money" require="true" />
							<label>Fare</label>
							<input type="text" size="10" name="farefree" id="team-create-farefree" class="number" value="<?php echo intval($team['farefree']); ?>" maxLength="6" datatype="money" require="true" />
							<span class="hint">custos dos correios, um único número gratuito: 0 não pode ajudar mas o frete, 2 disse que a compra de dois frete grátis</span>
						</div>
						<div class="field">
							<label>Local de entrega</label>
							<div style="float:left;"><textarea cols="45" rows="5" name="express" id="team-create-express" class="f-textarea editor2"><?php echo $team['express']; ?></textarea></div>
						</div>
					</div>
					<input type="submit" value="Salvar" name="commit" id="leader-submit" class="formbutton" style="margin:10px 0 0 120px;"/>
				</form>
                </div>
            </div>
            <div class="box-bottom"></div>
        </div>
	</div>
<div id="sidebar">
</div>

</div>
</div> <!-- bd end -->
</div> <!-- bdw end -->
<?php include template("manage_footer");?>
